<?php
declare (strict_types=1);

namespace app\admin\validates;

use think\Validate;

/**
 * AdvertiserPage验证器
 */
class AdvertiserPageValidate extends Validate
{
    /**
     * 验证规则
     * @var array
     */
    protected $rule = [
        'id' => 'require|number',
        'code' => 'require|alphaDash|max:50',
        'name' => 'require|chsAlphaNum|max:50',
        'pictures' => 'require|number|between:1,10',
        'example' => 'require|max:255',
        'desc' => 'require|chsAlphaNum|max:255',
        'status' => 'require|number|in:0,1',
        'device_type' => 'require|array',
    ];

    /**
     * 验证字段描述
     * @var string[]
     */
    protected $field = [
        'id' => 'ID',
        'code' => '展示位编码',
        'name' => '展示位名称',
        'pictures' => '最大上传图片数量',
        'example' => '展示位示例图',
        'desc' => '位置说明',
        'status' => '状态',
        'device_type' => '设备类型',
    ];

    /**
     * 验证场景
     * @var array
     */
    protected $scene = [
        'add' => ['code', 'name', 'pictures', 'example', 'desc', 'status', 'device_type'],
        'edit' => ['id', 'code', 'name', 'pictures', 'example', 'desc', 'status', 'device_type'],
        'del' => ['id'],
        'status' => ['id', 'status'],
    ];

}